home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / QuickDraw 3D / RAVE SDK 1.5 MacOS / Headers / RAVE_system.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-14  |  11.3 KB  |  264 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        RAVE_system.h                                             **
  4.  **                                                                          **
  5.  **     Purpose:     Header file for RAVE 3D drawing engine SPI                 **
  6.  **                                                                          **
  7.  **     Author:        Mike W. Kelley                                             **
  8.  **                                                                          **
  9.  **     Copyright (C) 1994-95 Apple Computer, Inc.  All rights reserved.     **
  10.  **        OpenGLâ„¢ is a trademark of Silicon Graphics, Inc.                     **
  11.  **                                                                          **
  12.  *****************************************************************************/
  13.  
  14. #ifndef _Drive3D_system_h
  15. #define _Drive3D_system_h
  16.  
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20.  
  21. /************************************************************************************************
  22.  *
  23.  * Typedefs of texture/bitmap method functions provided by the drawing engine.
  24.  *
  25.  ***********************************************************************************************/
  26.  
  27. typedef TQAError (*TQAColorTableNew)(
  28.     TQAColorTableType    pixelType,            /* Depth, color space, etc. */
  29.     void                *pixelData,            /* lookup table entries in pixelType format */
  30.     long                transparentIndex,    /* boolean, false means no transparency, true means index 0 is transparent */
  31.     TQAColorTable        **newTable);        /* (Out) Newly created TQAColorTable */
  32.  
  33. typedef void (*TQAColorTableDelete)(
  34.     TQAColorTable        *colorTable);        /* Previously allocated by QAColorTableNew() */
  35.  
  36. typedef TQAError (*TQATextureNew) (
  37.     unsigned long        flags,                /* Mask of kQATexture_xxx flags */
  38.     TQAImagePixelType    pixelType,            /* Depth, color space, etc. */
  39.     const TQAImage        images[],            /* Image(s) for texture */
  40.     TQATexture            **newTexture);        /* (Out) Newly created TQATexture, or NULL on error */ 
  41.  
  42. typedef TQAError (*TQATextureDetach) (
  43.     TQATexture            *texture);            /* Previously allocated by QATextureNew() */
  44.  
  45. typedef void (*TQATextureDelete) (
  46.     TQATexture            *texture);            /* Previously allocated by QATextureNew() */
  47.  
  48. typedef TQAError (*TQATextureBindColorTable)(
  49.     TQATexture            *texture,            /* Previously allocated by QATextureNew() */
  50.     TQAColorTable        *colorTable);        /* Previously allocated by QAColorTableNew() */
  51.     
  52. typedef TQAError (*TQABitmapNew) (
  53.     unsigned long        flags,                /* Mask of kQABitmap_xxx flags */
  54.     TQAImagePixelType    pixelType,            /* Depth, color space, etc. */
  55.     const TQAImage        *image,                /* Image */
  56.     TQABitmap            **newBitmap);        /* (Out) Newly created TQABitmap, or NULL on error */ 
  57.  
  58. typedef TQAError (*TQABitmapDetach) (
  59.     TQABitmap            *bitmap);            /* Previously allocated by QABitmapNew() */
  60.  
  61. typedef void (*TQABitmapDelete) (
  62.     TQABitmap            *bitmap);            /* Previously allocated by QABitmapNew() */
  63.  
  64. typedef TQAError (*TQABitmapBindColorTable)(
  65.     TQABitmap            *bitmap,            /* Previously allocated by QABitmapNew() */
  66.     TQAColorTable        *colorTable);        /* Previously allocated by QAColorTableNew() */
  67.     
  68. /************************************************************************************************
  69.  *
  70.  * Typedefs of private (system-only) functions provided by the drawing engine.
  71.  *
  72.  * The TQADrawPrivateNew function returns a TQADrawPrivate *, which points to the
  73.  * engine-specific private data created for the context. (TQADrawPrivate is a dummy
  74.  * type which is then cast to the correct engine-specific datatype by the engine code.)
  75.  *
  76.  * The TQADrawPrivateDelete function deletes the engine-specific private data.
  77.  *
  78.  * TQAStorePrivateNew and TQAStorePrivateDelete provide the same function as QADrawPrivateNew
  79.  * and TQADrawPrivateDelete, but for the texture and bitmap storage context.
  80.  *
  81.  * TQADrawMethodGet and TQAStoreMethodGet are called by the RAVE manager to retrieve
  82.  * the method pointers for a drawing engine.
  83.  *
  84.  * The TQAEngineCheckDevice function returns TRUE if the engine can render to the
  85.  * indicated GDevice.
  86.  *
  87.  ***********************************************************************************************/
  88.  
  89. typedef TQAError (*TQADrawPrivateNew) (
  90.     TQADrawContext        *newDrawContext,    /* Draw context to initialize */
  91.     const TQADevice        *device,            /* Target device */
  92.     const TQARect        *rect,                /* Target rectangle (device coordinates) */
  93.     const TQAClip        *clip,                /* 2D clip region (or NULL) */
  94.     unsigned long        flags);                /* Mask of kQAContext_xxx */
  95.  
  96. typedef void (*TQADrawPrivateDelete) (
  97.     TQADrawPrivate        *drawPrivate);        /* Private context data to delete */
  98.  
  99. typedef TQAError (*TQAEngineCheckDevice) (
  100.     const TQADevice        *device);            /* Target device */
  101.     
  102. typedef TQAError (*TQAEngineGestalt) (
  103.     TQAGestaltSelector    selector,            /* Gestalt parameter being requested */
  104.     void                *response);            /* Buffer that receives response */
  105.  
  106. /************************************************************************************************
  107.  *
  108.  * The TQAEngineMethod union is used to represent a single engine method (it's a
  109.  * parameter to QAEngineGetMethod). TQAEngineMethodTag identifies which method is being
  110.  * requested.
  111.  *
  112.  ***********************************************************************************************/
  113.  
  114. typedef union TQAEngineMethod
  115. {
  116.     TQADrawPrivateNew        drawPrivateNew;        /* Method: Create a private draw context */
  117.     TQADrawPrivateDelete    drawPrivateDelete;    /* Method: Delete a private draw context */
  118.     TQAEngineCheckDevice    engineCheckDevice;    /* Method: Check a device for drawing */
  119.     TQAEngineGestalt        engineGestalt;        /* Method: Gestalt */
  120.     TQATextureNew            textureNew;            /* Method: Create a texture (load is non-blocking) */
  121.     TQATextureDetach        textureDetach;        /* Method: Complete load of a texture (blocking) */
  122.     TQATextureDelete        textureDelete;        /* Method: Delete a texture */
  123.     TQABitmapNew            bitmapNew;            /* Method: Create a bitmap (load is non-blocking)  */
  124.     TQABitmapDetach            bitmapDetach;        /* Method: Complete load of a bitmap (blocking) */
  125.     TQABitmapDelete            bitmapDelete;        /* Method: Delete a bitmap */
  126.     TQAColorTableNew        colorTableNew;        /* Method: Create a new color table */
  127.     TQAColorTableDelete        colorTableDelete;    /* Method: Create a new color table */
  128.     TQATextureBindColorTable    textureBindColorTable;    /* Method: Bind a CLUT to a texture */
  129.     TQABitmapBindColorTable        bitmapBindColorTable;    /* Method: Bind a CLUT to a bitmap */
  130. } TQAEngineMethod;
  131.  
  132. typedef enum TQAEngineMethodTag
  133. {
  134.     kQADrawPrivateNew        = 0,
  135.     kQADrawPrivateDelete    = 1,
  136.     kQAEngineCheckDevice    = 2,
  137.     kQAEngineGestalt        = 3,
  138.     kQATextureNew            = 4,
  139.     kQATextureDetach        = 5,
  140.     kQATextureDelete        = 6,
  141.     kQABitmapNew            = 7,
  142.     kQABitmapDetach            = 8,
  143.     kQABitmapDelete            = 9,
  144.     kQAColorTableNew        = 10,
  145.     kQAColorTableDelete        = 11,
  146.     kQATextureBindColorTable    = 12,
  147.     kQABitmapBindColorTable        = 13
  148. } TQAEngineMethodTag;
  149.  
  150. /************************************************************************************************
  151.  *
  152.  * QARegisterEngine() registers a new engine. This is called at boot time by the drawing engine
  153.  * initialization code to register itself with the system. This call takes only one parameter,
  154.  * the engine's function that allows the manager to request the other methods.
  155.  *
  156.  ***********************************************************************************************/
  157.  
  158. typedef TQAError (*TQAEngineGetMethod) (
  159.     TQAEngineMethodTag        methodTag,                /* Method being requested */
  160.     TQAEngineMethod            *method);                /* (Out) Method */
  161.  
  162. RAVE_EXPORT TQAError QARegisterEngine (
  163.     TQAEngineGetMethod        engineGetMethod);        /* Engine's getMethod method */
  164.  
  165. /************************************************************************************************
  166.  *
  167.  * The TQADrawMethod union is used to represent a single draw context method (it's a
  168.  * parameter to QARegisterDrawMethod). TQADrawMethodTag identifies which method is being
  169.  * passed.
  170.  *
  171.  ***********************************************************************************************/
  172.  
  173. typedef union TQADrawMethod
  174. {
  175.     TQASetFloat                setFloat;            /* Method: Set a float state variable */
  176.     TQASetInt                setInt;                /* Method: Set an unsigned long state variable */
  177.     TQASetPtr                setPtr;                /* Method: Set an unsigned long state variable */
  178.     TQAGetFloat                getFloat;            /* Method: Get a float state variable */
  179.     TQAGetInt                getInt;                /* Method: Get an unsigned long state variable */
  180.     TQAGetPtr                getPtr;                /* Method: Get an pointer state variable */
  181.     TQADrawPoint            drawPoint;            /* Method: Draw a point */
  182.     TQADrawLine                drawLine;            /* Method: Draw a line */
  183.     TQADrawTriGouraud        drawTriGouraud;        /* Method: Draw a Gouraud shaded triangle */
  184.     TQADrawTriTexture        drawTriTexture;        /* Method: Draw a texture mapped triangle */
  185.     TQADrawVGouraud            drawVGouraud;        /* Method: Draw Gouraud vertices */
  186.     TQADrawVTexture            drawVTexture;        /* Method: Draw texture vertices */
  187.     TQADrawBitmap            drawBitmap;            /* Method: Draw a bitmap */
  188.     TQARenderStart            renderStart;        /* Method: Initialize for rendering */
  189.     TQARenderEnd            renderEnd;            /* Method: Complete rendering and display */
  190.     TQARenderAbort            renderAbort;        /* Method: Abort any outstanding rendering (blocking) */
  191.     TQAFlush                flush;                /* Method: Start render of any queued commands (non-blocking) */
  192.     TQASync                    sync;                /* Method: Wait for completion of all rendering (blocking) */
  193.     TQASubmitVerticesGouraud    submitVerticesGouraud;    /* Method: Submit Gouraud vertices for trimesh */
  194.     TQASubmitVerticesTexture    submitVerticesTexture;    /* Method: Submit Texture vertices for trimesh */
  195.     TQADrawTriMeshGouraud        drawTriMeshGouraud;        /* Method: Draw a Gouraud triangle mesh */
  196.     TQADrawTriMeshTexture        drawTriMeshTexture;        /* Method: Draw a Texture triangle mesh */
  197.     TQASetNoticeMethod            setNoticeMethod;        /* Method: Set a notice method */
  198.     TQAGetNoticeMethod            getNoticeMethod;        /* Method: Get a notice method */
  199. } TQADrawMethod;
  200.  
  201. typedef enum TQADrawMethodTag
  202. {
  203.     kQASetFloat                = 0,
  204.     kQASetInt                = 1,
  205.     kQASetPtr                = 2,
  206.     kQAGetFloat                = 3,
  207.     kQAGetInt                = 4,
  208.     kQAGetPtr                = 5,
  209.     kQADrawPoint            = 6,
  210.     kQADrawLine                = 7,
  211.     kQADrawTriGouraud        = 8,
  212.     kQADrawTriTexture        = 9,
  213.     kQADrawVGouraud            = 10,
  214.     kQADrawVTexture            = 11,
  215.     kQADrawBitmap            = 12,
  216.     kQARenderStart            = 13,
  217.     kQARenderEnd            = 14,
  218.     kQARenderAbort            = 15,
  219.     kQAFlush                = 16,
  220.     kQASync                    = 17,
  221.     kQASubmitVerticesGouraud    = 18,
  222.     kQASubmitVerticesTexture    = 19,
  223.     kQADrawTriMeshGouraud        = 20,
  224.     kQADrawTriMeshTexture        = 21,
  225.     kQASetNoticeMethod            = 22,
  226.     kQAGetNoticeMethod            = 23
  227. } TQADrawMethodTag;
  228.  
  229. /************************************************************************************************
  230.  *
  231.  * System call to register a new method for an engine. This is called during the engine's
  232.  * draw private new functions (to set the initial value of the draw methods), and possibly
  233.  * at other times when the engine needs to change a draw method.
  234.  *
  235.  ***********************************************************************************************/
  236.  
  237. RAVE_EXPORT TQAError QARegisterDrawMethod (
  238.     TQADrawContext            *drawContext,            /* Draw context in which to set method */
  239.     TQADrawMethodTag        methodTag,                /* Method to set */
  240.     TQADrawMethod            method);                /* Method */
  241.  
  242. /************************************************************************************************
  243.  *
  244.  * RAVE Prefs file.
  245.  *
  246.  ***********************************************************************************************/
  247.  
  248.                                            /*  1        .     1            d            1   */
  249. #define kQAPrefsFileVersion_Current            ((1 << 24) + (1 << 16) + (0x20 << 8) + (1))
  250.  
  251. #define kQAPrefsFileVersion_Minimum            kQAPrefsFileVersion_Current
  252.  
  253. /************************************************************************************************
  254.  *
  255.  * Debugging functions.
  256.  *
  257.  ***********************************************************************************************/
  258.  
  259. #ifdef __cplusplus
  260. }
  261. #endif
  262.  
  263. #endif /* _Drive3D_system_h */
  264.